<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,user-scalable=no,minimal-ui">
        <title>菩提阁</title>
        <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
        <link rel="stylesheet" href="../css/order.css">
        <link rel="stylesheet" href="../css/message.css">
    </head>
    <body>
        <div id="order" class="app">
            <div class="divHead">
                <div class="divTitle">
                    <i class="el-icon-arrow-left" @click="goBack"></i>菩提阁
                </div>
            </div>
            <div class="divBody" v-if="orderList.length > 0">
                <div>
                    <div v-for="(order,index) in orderList" :key="index" class="item">
                        <div class="timeStatus">
                            <span>{{order.payDateTime}}</span>
<!--                            <span>{{getStatus(order.status)}}</span>-->
                             <span>正在派送</span>
                        </div>
                        <div class="dishList">
                            <div v-for="(item,index) in order.orderList" :key="index" class="item">
                                <span>{{item.name}}</span>
                                <span>x{{item.num}}</span>
                            </div>
                        </div>
                        <div class="result">
                            <span>共{{order.sunNum}} 件商品,实付</span><span class="price">￥{{order.money}}</span>
                        </div>
                        <div class="btn" v-if="order.status === 4">
                            <div class="btnAgain" @click="addOrderAgain(order)">再来一单</div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="divNoData" v-else>
                <div class="divContainer">
                    <img src="./../images/no_order.png"/>
                    <div>暂无订单</div>
                </div>
            </div>
        </div>
        <!-- 开发环境版本，包含了有帮助的命令行警告 -->
        <script src="../js/vue.js"></script>
        <script src="../js/axios.min.js"></script>
        <script src="../js/interceptors.js"></script>
        <script src="https://unpkg.com/element-ui/lib/index.js"></script>
        <script>
        new Vue({
            el:"#order",
            data: {

                paging: {
                    page: 1,
                    pageSize: 5
                },
                orderList: [],
                loading: false,
                finished: false

            },

            mounted(){
                this.getOrderList();
            },
            methods: {
                goBack() {
                    location.href = "/font/index.html";
                },
                getOrderList(){
                    axios.get("/font/indent/list")
                        .then(res =>{
                            if (res.data.code == 20041){
                                this.orderList = res.data.data;
                            }
                        })
                        .catch(err =>{
                            this.$message.error("接口异常");
                        })
                },

            }
        })
        </script>
    </body>
</html>